package com.hisicom.scqxspxcjc.controller;

import com.hisicom.scqxspxcjc.base.bean.Result;
import com.hisicom.scqxspxcjc.sceneCheck.report.domain.Report;
import com.hisicom.scqxspxcjc.services.ReportServiceBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhonggls
 * @date 2023/9/7 15:02
 * @Explain
 */
@RestController
@RequestMapping("sceneCheck/report")
public class ReportController {
    @Autowired
    ReportServiceBus reportServiceBus;


    /**
     * 通过组id获取"现场检查"栏对象集合
     * @param groupId 分组id
     * @return "现场检查"栏对象集合
     */
    @GetMapping(value = "findByGroupId")
    public Object findByGroupId(String groupId) {
        Object object = reportServiceBus.findByGroupId(groupId);
        return Result.success(object);
    }

    /**
     * 保存现场检查报告
     * @param report "现场检查"对象集合数据
     * @return 成功/失败
     */
    @PostMapping(value = "add")
    public Object add(@RequestBody Report report)  {
        reportServiceBus.add(report);
        return Result.success();
    }
}
